#include <windows.h>
#include <stdio.h>
#include <string.h>

const DWORD BUFSIZE = 1024;
const DWORD PIPE_TIMEOUT = 5000;

int main()
{
    //HANDLE hFile = CreateFileW(L"\\\\.\\pipe\\Dbzhang800Pipe", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
    HANDLE hFile = CreateFileW(L"\\\\.\\mailslot\\qt4\\dbzhang800", GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if(hFile == INVALID_HANDLE_VALUE) {
        printf("cannot connect to Named Pipe\n" );
    } else {
        DWORD dwWrite;
        char szPipeUpdate[200] = "Data from Named Pipe client";
        WriteFile(hFile, szPipeUpdate, strlen(szPipeUpdate), &dwWrite, NULL);
        printf("%i bytes has send", (int)dwWrite);
        CloseHandle(hFile);
    }
    return 0;
}

